class Solution:
    _MOD = 10 ** 9 + 7

    def countHomogenous(self, s: str) -> int:
        ans = 0
        now, num = "", 0
        for ch in s:
            if ch != now:
                now, num = ch, 1
            else:
                num += 1
            ans = (ans + num) % self._MOD
        return ans % self._MOD


if __name__ == "__main__":
    print(Solution().countHomogenous("abbcccaa"))  # 13
    print(Solution().countHomogenous("xy"))  # 2
    print(Solution().countHomogenous("zzzzz"))  # 15
